package zxd.util;

import redis.clients.jedis.Jedis;

import java.util.Iterator;
import java.util.Set;

/**
 * Created by 张旭东 on 2017/8/31.
 */
public class RedisClient {
    public static void connectRedisClient(){
        Jedis jedis = new Jedis("127.0.0.1",6379);
        System.out.println("是否存在指定key：   "+jedis.exists("biu"));
        jedis.exists("biu");
//        jedis.set("biu","biubiubiu");
        Set<String> sets = jedis.keys("*");
        System.out.println(sets.size());
        Iterator iterator = sets.iterator();
        System.out.println("::::::::::::"+jedis.hgetAll("USER:zxd"));
        while (iterator.hasNext()){
//            System.out.println("-------------"+iterator.next());
            String key =  (String)iterator.next();
            System.out.println(jedis.type(key) +"  " +key);
        }
//        System.out.println(jedis.type("userName"));

    }

}
